
exports.getCookie = function (name) {
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}

exports.delCookie = function(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        document.cookie= name + "="+unescape(arr[2])+";expires="+exp.toGMTString();
}